<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path = request.getContextPath();%>
<style>
    table tr{
        text-align: center;
    }
</style>
<style>
    #hide{
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        position: fixed;
        background-image: url("<%=path%>/static/web/css/img/overlay.png");
        opacity: 1;
        z-index: 100;
        display: none;
    }
    #hide #mes{
        margin: 0;
        padding: 0;
        width: 40%;
        height: 45%;
        position: absolute;
        left: 30%;
        top: 15%;
        z-index: 120;
        border: #3a3a3a 8px solid;
        background-color: #cccccc;
        overflow: auto;
    }
    #hide #mes #header{
        margin: 0;
        padding: 0;
        background-color:#019875;
        height: 50px;
        z-index: 150;
        color: white;
    }
    #hide #mes #header #but{
        position: relative;
        background-image: url("<%=path%>/static/web/css/img/controls.png");
        width: 30px;
        height: 30px;
        float: right;
        border:#019875 0px solid;
    }
    #hide #mes #header #but:hover{
        cursor: pointer;
    }
    #hide #mes #header #tit{
        font-size: 25px;

    }
    #hide #mes div {
        text-align: center;
        margin-top: 10px;
        padding: 0;
        height: 50px;
        z-index: 150;
        color: #0C0C0C;
        font-size: 20px;
    }
    #hide #mes #ok{
        margin-top: 40px;
    }
    #hide #mes #ok input:hover{
        cursor: pointer;
        color: #019875;
    }
</style>
<style>
    #hideing{
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        position: fixed;
        background-image: url("<%=path%>/static/web/css/img/overlay.png");
        opacity: 1;
        z-index: 100;
        display: none;
    }
    #hideing #mesg{
        margin: 0;
        padding: 0;
        width: 40%;
        height: 40%;
        position: absolute;
        left: 30%;
        top: 15%;
        z-index: 120;
        border: #3a3a3a 8px solid;
        background-color: #cccccc;
        overflow: auto;
    }
    #hideing #mesg #headers{
        margin: 0;
        padding: 0;
        background-color:#019875;
        height: 50px;
        z-index: 150;
        color: white;
    }
    #hideing #mesg #headers #butt{
        position: relative;
        background-image: url("<%=path%>/static/web/css/img/controls.png");
        width: 30px;
        height: 30px;
        float: right;
        border:#019875 0px solid;
    }
    #hideing #mesg #headers #butt:hover{
        cursor: pointer;
    }
    #hideing #mesg #headers #sub{
        font-size: 25px;

    }
    #hideing #mesg div {
        text-align: center;
        margin-top: 10px;
        padding: 0;
        height: 50px;
        z-index: 150;
        color: #0C0C0C;
        font-size: 20px;
    }
    #hideing #mesg #oks{
        margin-top: 40px;
    }
    #hideing #mesg #oks input:hover{
        cursor: pointer;
        color: #019875;
    }
</style>
<div id="hide">
    <div id="mes">
        <div id="header">
            <span id="tit">修改</span>
            <button id="but"></button>
        </div>
        <div>
            <span>名称:&nbsp;</span>
            <input type="text" id="title">
        </div>
        <div id="ok">
            <span style="margin-left: 10px">
                <input type="button" id="button" style="font-size: 20px" value="确定">
            </span>
        </div>
    </div>
</div>
<div id="hideing">
    <div id="mesg">
        <div id="headers">
            <span id="sub">添加薪资范围</span>
            <button id="butt"></button>
        </div>
        <div id="likes">
            <span>名称:&nbsp;</span>
            <input type="text" id="addMoney">
        </div>
        <div id="oks">
            <span style="margin-left: 10px">
                <input type="button" id="buttons" style="font-size: 20px" value="确定">
            </span>
        </div>
    </div>
</div>
<jsp:include page="/manage/inc/header"/>
<jsp:include page="/manage/inc/menu"/>
<script>
    $(function () {
        //删除
        $(".link-del").click(function () {
            var id = $(this).attr("id");
            $.get("<%=path%>/manage/money/del",{id:id},function () {
                $(this).parent().parent().remove();
            }.bind(this));
            return false;
        });
        //修改
        $("#but").click(function () {
            $("#hide").css("display","none");
        });
        var id = "";
        $(".link-update").click(function () {
            id = $(this).attr("id");
            var range = $(this).parent().prev().prev().html();
            $("#title").val(range);
            $("#hide").css("display","block");
        });
        $("#button").click(function () {
            var range = $("#title").val();
            if (range==""){
                return;
            }
            $.get("<%=path%>/manage/money/update",{range:range,id:id},function () {
                $("#hide").css("display","none");
                location.reload();
            });
        });
        //修改
        $("#butt").click(function () {
            $("#hideing").css("display","none");
        });
        $(".link-add").click(function () {
            $("#hideing").css("display","block");
        });
        $("#buttons").click(function () {
            var range = $("#addMoney").val();
            if (range==""){
                return;
            }
            $.get("<%=path%>/manage/money/insert",{range:range},function () {
                $("#hideing").css("display","none");
                location.reload();
            });
        });
    });
</script>

    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="<%=path%>/manage/index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">薪资范围管理</span></div>
        </div>
        <div class="result-wrap">

                <div class="result-title">
                    <div class="result-list">
                        <a href="#" class="link-add"><i class="icon-font"></i>新增工资范围</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th>ID</th>
                            <th>范围</th>
                            <th>添加时间</th>
                            <th>操作</th>
                        </tr>
                        <c:forEach items="${requestScope.monies}" var="money">
                            <tr>
                                <td>${money.id}</td>
                                <td>${money.range}</td>
                                <td><fmt:formatDate value="${money.inputTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                                <td>
                                    <a class="link-update" href="#" id="${money.id}">修改</a>
                                    <a class="link-del" href="#" id="${money.id}">删除</a>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </div>

        </div>
    </div>
    <!--/main-->
</div>
<jsp:include page="/manage/inc/footer"/>
